import request from '/@/utils/request';


export const pageList = (params?: Object) => {
	return request({
		url: '/admin/scadaProperty/page',
		method: 'get',
		params,
	});
};

export const addObj = (obj: Object) => {
	return request({
		url: '/admin/scadaProperty',
		method: 'post',
		data: obj,
	});
};


export const putObj = (obj: Object) => {
	return request({
		url: '/admin/scadaProperty',
		method: 'put',
		data: obj,
	});
};

export const getObj = (id: String) => {
	return request({
		url: '/admin/user/details/' + id,
		method: 'get',
	});
};

export const delObj = (ids: Object) => {
	return request({
		url: '/admin/scadaProperty/removeDeep',
		method: 'delete',
		data: ids,
	});
};


// 查询组态未绑定的设备列表
export const unbindDevList = (params?: Object) => {
	return request({
		url: '/admin/scadaDevice/getDeviceList',
		method: 'get',
		params
	})
}

// 设备绑定关联组态
export const bindDevData = (obj?: Object) => {
	return request({
		url: '/admin/scadaDevice',
		method: 'post',
		data: obj
	})
}


// 查询组态已绑定的设备列表
export const bindDevList = (params?: Object) => {
	return request({
		url: '/admin/scadaDevice/queryByScadaId',
		method: 'get',
		params
	})
}

// 删除组态已绑定的设备
export const deleteDev = (data?: Object) => {
	return request({
		url: '/admin/scadaDevice',
		method: 'delete',
		data: data
	})
}


//查询所属产品

export const productList = (params?: Object) => {
	return request({
		url: '/admin/accessProduct/page',
		method: 'get',
		params
	})
}

//查询组态绑定的设备绑定的通道
export const chanelDevList = (params?: Object) => {
	return request({
		url: '/admin/scadaModel',
		method: 'get',
		params
	})
}


//查询组态绑定的设备绑定的通道
export const chanelDevListEdit = (obj?: Object) => {
	return request({
		url: '/admin/scadaModel',
		method: 'put',
		data: obj
	})
}

//组态场景新增
export const sceneObjData = (obj?: Object) => {
	return request({
		url: '/admin/scadaFolder',
		method: 'post',
		data: obj
	})
}

//组态场景查询
export const sceneObjQuery2 = (params?: Object) => {
	return request({
		url: '/admin/scadaFolder/tree',
		method: 'get',
		params
	})
}
export const sceneObjQuery = (params?: Object) => {
	return request({
		url: '/admin/scadaFolder/firstTree',
		method: 'get',
		params
	})
}
//组态场景查询详细信息
export const sceneObjDetail = (id?: Object) => {
	return request({
		url: '/admin/scadaFolder/' + id,
		method: 'get'
	})
}

//组态场景删除
export const sceneObjDelete = (ids?: Object) => {
	return request({
		url: '/admin/scadaFolder',
		method: 'delete',
		data: ids
	})
}
//组态场景修改
export const sceneObjEdit = (obj?: Object) => {
	return request({
		url: '/admin/scadaFolder',
		method: 'put',
		data: obj
	})
}

// 获取已经配置的场景目录
export const sceneListQuery = (params?: Object) => {
	return request({
		url: '/admin/scadaFolder/tree?type=0',
		method: 'get',
		params
	})
}

// 获取已经绑定的组态文件列表
export const zutaiListQuery = (params?: Object) => {
	return request({
		url: '/admin/scadaFolder/getScadaInfo',
		method: 'get',
		params
	})
}


export const zutaiDevinfo =  (unitNo?: String) => {
	return request({
		url: `/admin/scadaModel/thing?unitNo=${unitNo}`,
		method: 'get',
	})
}
//同步组态
export const syncZutai =  (obj?: Object) => {
	return request({
		url: '/admin/scadaProperty/changeAllJson',
		method: 'post',
	})
}
// 视频
export function getDevice(obj?: string) {
    return request({
      url: '/camera/device/login',
      method: 'post',
      data: obj
    })
  }

//   查看规则 下拉数据
export function queryCheckList(query?: Object) {
	 return request({
		 url: '/excesysiot/sceneLinkage/page',
		 method: 'get',
		 params: query
	 })
}

//   查看规则 下拉数据 保存
export function setScadaAndLinked(obj?: string) {
    return request({
      url: '/admin/scadaAndLinked',
      method: 'post',
      data: obj
    })
  }
//   查看规则 下拉数据
export function getListData(query?: Object) {
	return request({
		url: '/admin/scadaAndLinked/page',
		method: 'get',
		params: query
	})
}
// 移除绑定
  export const delRuleObj = (id: string) => {
    return request({
        url: '/admin/scadaAndLinked/' + id,
        method: 'delete',
    });
};

	

